<!doctype html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>店铺申请_店铺管理|速定客_预订美好生活！</title>
<meta content="IE=EmulateIE7" http-equiv="X-UA-Compatible">
<meta content="外卖信息,中山外卖送餐,网上订餐,-,,速定客,速订客，预订美好生活！外卖订餐美食网" name="keywords">
<meta content="速订客—外卖网，订餐，美食。最好的网上订餐平台，为您提供最新最全的24小时外卖送餐电话、外卖菜单等外卖订餐详细信息。包括肯德基网上订餐电话，麦当劳网上订餐电话。" name="description">
<link rel="stylesheet" type="text/css" href="http://img2.sudingke.com/css/base.css">
<link rel="stylesheet" type="text/css" href="http://img.sudingke.net/css/member/global.css">
<link rel="stylesheet" type="text/css" href="http://img.sudingke.net/css/member/member.css">
<link href="http://img2.sudingke.com/favicon.ico" type="image/x-icon" rel="icon" />
<link href="http://img2.sudingke.com/favicon.ico" type="image/x-icon" rel="shortcut icon" />
<body>
<!-- header start -->
<?php include $this->tpl('c_header'); ?>
<!-- header close -->

<div class="clearfix" id="bd">
  <div id="yao-main">
    <div class="yao-b">
      <?php include $this->tpl('c_news'); ?>
      <div class="mod mod-title" id="ucInfo">
        <form action="?m=biz&c=create&a=save" id="aform" method="post" autocomplete="off">
          <div class="hd">
            <h2>店铺申请</h2>
          </div>
          <div class="bd">
            <div class="info-read">您还没有申请开通店铺。请按照下述操作开通店铺。</div>
            <table cellspacing="0" cellpadding="0" border="0" class="table-two">
              <tbody>
                <tr>
                  <th><span class="required">*</span> 店铺名称：</th>
                  <td><input type="text" class="input-m" name="name" id="name" required minlength="4" value="<?=h($data['name']);?>" />
                    <?=showTips($error['name'], '例如：速订客面馆（人民路店）');?></td>
                </tr>
                <tr>
                  <th><span class="required">*</span> 联系人：</th>
                  <td><input type="text" class="input-s" id="contact" name="contact" required minlength="2" value="<?=h($data['contact']);?>" />
                    <?=showTips($error['contact'], '');?></td>
                </tr>
                <tr>
                  <th><span class="required">*</span> 手机号码：</th>
                  <td><input type="text" data-rules="mobile" class="input-s" id="mobile" name="mobile" required value="<?=h($data['mobile']);?>" />
                    <?=showTips($error['mobile'], '申请通过后，自动开通店铺');?>
                    <button type="button" id="sendcode" style="display:none">获取验证码</button></td>
                </tr>
                <tr>
                  <th><span class="required">*</span> 验证码：</th>
                  <td><input type="text" class="input-s" id="verify" name="verify" required value="<?=h($data['verify']);?>" />
                    <span style="background:#000;color:#fff;padding:2px;font-weight:bold;">12345</span>
                    <?=showTips($error['verify'], '');?></td>
                </tr>
                <tr class="table-ft">
                  <th>&nbsp;</th>
                  <td><div class="ucinfo-row"> <span class="btni04 submit"> <span>
                      <input type="hidden" name="submitform" value="yes">
                      <input type="submit" class=" js-log" hidefocus="true" value="申 请">
                      </span> </span>
                    </div></td>
                </tr>
              </tbody>
            </table>
          </div>
        </form>
        <div>&nbsp;</div>
      </div>
    </div>
  </div>
  <?php include $this->tpl('c_menunav'); ?>
</div>

<!-- footer start -->
<?php include $this->tpl('c_footer'); ?>
<!-- footer close -->

<script src="http://autocar.com/statics/js/jquery.js" language="JavaScript"></script>
<script src="http://autocar.com/statics/js/supe.js" language="JavaScript"></script>
<script type="text/javascript">

$(function(){
  $("#sendcode").click(function(){
    ;
  });

  Supe.use('validate', function(){
    $("#aform").validate({
        errorClass:'v-error',
        validClass:'v-valid',
        errorElement: 'span',
        ignore: '',
        errorPlacement:function(label, element){
            if(element[0].id == "mobile"){
                element.parent().find("button").hide();
            }

            if(element.parent().find('.v-tips'))
                element.parent().find('.v-tips').remove();

            element.parent().append(label);
        },
        success: function(label, element) {
            //if(element.id == "mobile"){
            //    $(element).parent().find("button").show();
            //    label.html("&nbsp;").removeClass("v-error").addClass("v-tips");
            //}else{
                // set &nbsp; as text for IE
                label.html("&nbsp;").addClass("v-valid");
            //}
        },
        //submitHandler: function(form, e){
        //    e.preventDefault();
        //    formSubmit(form);
        //},
        rules: {
            'contact': {regexp: /^[\u4e00-\u9fa5]+$/},
            'verify' : {
                required: true,
                remote: {
                    url : '/account.php?m=system&c=mobile&a=checkverify',     //验证手机验证码
                    dataType: "json",
                    type : 'post',
                    data : {
                        verify : function(){
                            return $('#verify').val();
                        },
                        mobile : function(){
                            return $('#mobile').val();
                        }
                    }
                }
            }
        },
        messages:{
            'name' : {required: "店铺名称没有填写"},
            'contact'  : {required: "联系人必须填写", regexp: "联系人必须为中文"},
            'verify' : {required: "验证码必须填写", remote: "验证码填写错误"}
        }
    });
  });
});
</script>
</body>
</html>

<?php
    function showTips(&$error, $tips){
        if(get_request('submitform')){
            if(isset($error)) printf('<span class="v-error">%s</span>', $error);
            else echo '<span class="v-valid"></span>';
        }else{
            printf('<span class="v-tips">%s</span>', $tips);
        }
    }
?>